package com.qf.mvc2202.controller;

import com.qf.mvc2202.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
@Controller
@RequestMapping("/pass")
public class PassValueController {
    @RequestMapping("/test1")
    public String test1(HttpSession session, HttpServletRequest req){
        // 调用service层的代码，执行业务逻辑处理

        // 把拿到的数据放入request或者session对象中
        User user = new User();
        user.setName("jack");
        session.setAttribute("user",user);
        req.setAttribute("age",18);
        return "forward:/views/users.jsp";
    }
}
